/*
 * @Author: 橘子
 * @Date: 2021-10-08 21:30:09
 * @Project_description: 对外导出工具
 * @Description: 代码是我抄的，不会也是真的
 */
import cookies from './util.cookies'
import db from './util.db'
import log from './util.log'
import setting from '@/setting'

const util = {
  cookies,
  db,
  log,
}

/**
 * @description 更新标题
 * @param {String} title 标题
 */
util.title = function(titleText) {
  const processTitle = setting.appInfo.title || '后台管理'
  window.document.title = `${processTitle}${titleText ? ` | ${titleText}` : ''}`
}

/**
 * @description 打开新页面
 * @param {String} url 地址
 */
util.open = function(url) {
  var a = document.createElement('a')
  a.setAttribute('href', url)
  a.setAttribute('target', '_blank')
  a.setAttribute('id', 'd2admin-link-temp')
  document.body.appendChild(a)
  a.click()
  document.body.removeChild(document.getElementById('d2admin-link-temp'))
}

export default util
